/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Trabalho3.RegrasPasswordChecker01;

import Trabalho3.RuleFactory;

/**
 *
 * @author geraldo
 */
public class RegraBonusMultiplosChars implements RuleFactory{
    final int BONUS_MULTITIPOS_CARACTERES = 2;
    String password;

    public RegraBonusMultiplosChars(String password) {
        this.password = password;
    }

    
    @Override
    public int calcularRegra() {
     int bonus = 0;
     int RegraMaiusculas_E_Minusculas = (new RegraLetrasMaiusculas(password).calcularRegra()+ new RegraLetrasMinusculas(password).calcularRegra());
       
        bonus += calcularBonusEntreTiposCaracteres(new RegraLetrasMaiusculas(password).calcularRegra(), new RegraLetrasMinusculas(password).calcularRegra());
        bonus += calcularBonusEntreTiposCaracteres(RegraMaiusculas_E_Minusculas, new RegraDigitos(password).calcularRegra());
            if (RegraMaiusculas_E_Minusculas > 0 || new RegraDigitos(password).calcularRegra() > 0) {
            bonus += calcularBonusEntreTiposCaracteres(BONUS_MULTITIPOS_CARACTERES, new RegraSimbolos(password).calcularRegra());
            }
        return bonus;
    }
    
    public int calcularBonusEntreTiposCaracteres(int funcao1, int funcao2) {
        return (funcao1 > 0 && funcao2 > 0) ? BONUS_MULTITIPOS_CARACTERES : 0;
    }
 }